package Lambda.Consumer;


import java.util.function.Consumer;

//Consumer函数式接口：是消费一个数据
public class Consumerdemo {

        /*jdk源码：
        public interface Consumer<T> {//Consumer<T>参数是泛型,返回值是空的
            void accept(T t);*/
    private static void method(String name, Consumer<String> con){
       con.accept(name);

    }

    public static void main(String[] args) {
        method("赵丽颖",( String name)->{
            System.out.println(name);
            //字符串的反序
           StringBuffer reverse = new StringBuffer(name).reverse();
            System.out.println(reverse);
        });
    }
}
